#######################################
# Order of the Sacred Magdalene
# Retirement from Temporal Rule Events
#
# File:
# events/ggsm_retirement_events.txt
#######################################

namespace = ggsmr


#######################################
# ggsmr.1
# LAY ASIDE THE CROWN
#
# ROOT = retiring Magdalene ruler
#
# The current heir is saved before
# abdication. CK2 then handles succession
# normally through abdicate, including the
# normal inheritance on-actions.
#
# After abdication the former ruler receives
# the retirement trait and is explicitly moved
# into the new ruler's court.
#
# Existing marriage is deliberately untouched.
#######################################

long_character_event = {
	id = ggsmr.1
	desc = ggsmr.1.desc
	picture = GFX_evt_monastery_nuns
	border = GFX_event_long_frame_religion

	is_triggered_only = yes

	#######################################
	# CONFIRM RETIREMENT
	#######################################

	option = {
		name = ggsmr.1.a

		# Save the intended successor before ROOT
		# ceases to be the landed ruler.
		current_heir = {
			save_event_target_as = ggsm_retirement_heir
		}

		# Transfer all held titles by normal
		# succession to the current heir.
		abdicate = {
			move = no
		}

		# Retirement does not dissolve an existing
		# marriage. The trait only prevents a new
		# marriage and future inheritance.
		add_trait = ggsm_retired_magdalene

		# Explicitly place the former ruler in the
		# new ruler's court. This also covers an
		# abdicator who had been independent.
		hidden_tooltip = {
			event_target:ggsm_retirement_heir = {
				ROOT = {
					move_character = PREV
				}
			}
		}
	}

	#######################################
	# REMAIN ON THE THRONE
	#######################################

	option = {
		name = ggsmr.1.b
	}
}